<template>
	<view class="main">
		<view class="content" v-for="(i,inx) in afficheList" :key="i.id">
			<view class="">
				<view class="">{{i.info}}</view>
				<view class="">
					<view class="">{{i.add_time}}</view>
					<view @click="goDetail(i.id)">查看详情</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		homeAffiche
	} from '@/api/api.js'
export default {
	data() {
		return {
			afficheList:[]
		};
	},
	onLoad() {
		uni.showLoading({})
		this.homeAffiche()
	},
	// 分享
	onShareAppMessage() {
		return {
			title: '优栽园',
			path: 'page_home/announcement/announcement'
		};
	},
	// 分享到朋友圈
	onShareTimeline() {
		return {
			title: '优栽园',
			path: 'page_home/announcement/announcement'
		};
	},
	methods: {
		// 去详情
		goDetail(id){
			uni.navigateTo({
				url:'/page_home/announcementdetail/announcementdetail?id='+id
			})
		},
		// 获取公告
		homeAffiche(){
			homeAffiche().then(res=>{
				if(res.data.code == '200'){
					uni.hideLoading()
					this.afficheList = res.data.data
				}else {
					uni.hideLoading()
				}
			})
		},
	}
};
</script>

<style lang="scss">
.main {
	height: 100%;
	background-color: #f3f4f6;
	padding: 20rpx;
}
.content {
	padding: 30rpx;
	margin-bottom: 20rpx;
	background-color: #fff;
	border-radius: 20rpx;
	> view:nth-child(1) {
		> view:nth-child(1) {
			padding: 20rpx 0 100rpx 0;
		}
		> view:nth-child(2) {
			display: flex;
			justify-content: space-between;
			align-items: center;
			font-size: 26rpx;
			color: #ccc;
		}
	}
}
</style>
